<template>
  <ul class="tab-bar">
    <li
    is="router-link"
    tag="li"
    v-for="route in navs"
    :key="route.path"
    :to="route.path"
    >
    <i class="iconfont" v-html="route.meta.icon"></i>
    <span>{{route.meta.title}}</span>
    </li>
  </ul>
</template>

<script>
import routes from '@/router/routes'

export default {
  name: 'TabBar',
  computed: {
    navs () {
      return routes.filter(route => route.meta?.inTabbar)
    }
  }
}
</script>

<style lang="scss" scoped>
@font-face {
  font-family: 'iconfont';  /* Project id 2751104 */
  src: url('http://at.alicdn.com/t/font_2751104_z0qx9qaa3a9.woff2?t=1629193374083') format('woff2'),
      url('http://at.alicdn.com/t/font_2751104_z0qx9qaa3a9.woff?t=1629193374083') format('woff'),
      url('http://at.alicdn.com/t/font_2751104_z0qx9qaa3a9.ttf?t=1629193374083') format('truetype');
}

.iconfont{
  font-family:"iconfont" !important;
  font-size:16px;font-style:normal;
  -webkit-font-smoothing: antialiased;
  -webkit-text-stroke-width: 0.2px;
  -moz-osx-font-smoothing: grayscale;
}

.tab-bar {
  display: flex;
  border-top: 1px solid #ccc;
  padding-top: 6px;

  li {
    height: 100px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;

    .iconfont {
      font-size: 24px;
    }
  }
}
.router-link-exact-active, .router-link-active {
  color: #f00;
}
</style>
